<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCustomerDepartmentDevelopmentManagerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_department_development_manager', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('rmsUserId')->default(0)->comment('RMS 用户ID');
            $table->string('name', 25)->default(0)->comment('用户名');
            $table->string('phone', 13)->default('')->comment('手机号');
            $table->unsignedInteger('taskCount')->default(0)->comment('任务数量');
            $table->unsignedInteger('sTaskCount')->default(0)->comment('s任务数量');
            $table->unsignedInteger('aTaskCount')->default(0)->comment('a任务数量');
            $table->unsignedInteger('saTaskCount')->default(0)->comment('sa任务数量');
            $table->unsignedInteger('bTaskCount')->default(0)->comment('b任务数量');
            $table->unsignedInteger('cTaskCount')->default(0)->comment('c任务数量');
            $table->unsignedInteger('sTaskRatio')->default(0)->comment('s任务占比');
            $table->unsignedInteger('aTaskRatio')->default(0)->comment('a任务占比');
            $table->unsignedInteger('saTaskRatio')->default(0)->comment('sa任务占比');
            $table->unsignedInteger('bTaskRatio')->default(0)->comment('b任务占比');
            $table->unsignedInteger('cTaskRatio')->default(0)->comment('c任务占比');
            $table->unsignedInteger('effectiveClueCount')->default(0)->comment('有效点位线索数量');
            $table->unsignedInteger('effectiveHouseCount')->default(0)->comment('有效房源数量');
            $table->unsignedInteger('siteLocationCount')->default(0)->comment('确址数量');
            $table->unsignedInteger('onTheJobTime')->default(0)->comment('入职时间');
            $table->unsignedInteger('followUpTime')->default(0)->comment('最新跟进时间');
            $table->unsignedTinyInteger('isResigned')->default(0)->comment('岗位状态');
            $table->string('taskDistrict', 20)->default('')->comment('任务区域');
            $table->string('taskCity', 120)->default('')->comment('任务城市');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '大客户部开发经理管理';

            $table->index('rmsUserId', 'idx_rmsUserId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_department_development_manager');
    }
}
